from mkset import *
import os,json

dblis = os.listdir("dbs")
seqlis = [ str(one).split("_gt.db")[0] for one in dblis ]
print(dblis)
print(seqlis)

vdosrc = None
with open("vdo_src.json","r",encoding="utf-8") as fp:
    vdosrc = json.load(fp)

rds = ReidDataSet("sum_dataset")
# 加载数据库
for idx,(seq,filename) in enumerate(zip(seqlis,dblis)):
    print(f"{idx} -> {seq},{filename}")
    seq_db = DataBase(seq,os.path.join("dbs",filename))
    video = VideoLoader(vdosrc[seq])
    rst = ReidSubSet(seq_db,video)
    rds.AddSubSet(rst)

print(rds.GetAllUniqueNames())
# {'test10-commodity-4', 'test12-phone-0', 'test13-commodity-0', 'test10-commodity-5', 'test12-commodity-1', 'test08-commodity-4', 'test05-commodity-3', 'test09-phone-0', 'test13-commodity-5', 'test14-commodity-2', 'test14-commodity-3', 'test05-commodity-0', 'test01-commodity-4', 'test01-commodity-2', 'test09-commodity-0', 'test13-commodity-1', 'test08-phone-0', 'test05-commodity-1', 'test13-commodity-2', 'test10-commodity-7', 'test08-commodity-0', 'test09-commodity-3', 'test10-commodity-3', 'test04-commodity-3', 'test12-commodity-0', 'test12-commodity-3', 'test11-commodity-1', 'test09-commodity-2', 'test04-commodity-2', 'test10-phone-0', 'test08-commodity-1', 'test10-commodity-1', 'test10-commodity-6', 'test13-commodity-4', 'test14-commodity-5', 'test13-phone-0', 'test01-commodity-0', 'test11-phone-1', 'test04-commodity-4', 'test04-commodity-0', 'test12-commodity-5', 'test14-commodity-0', 'test05-phone-0', 'test11-commodity-0', 'test08-commodity-2', 'test10-commodity-0', 'test14-commodity-1', 'test01-phone-0', 'test14-commodity-4', 'test10-commodity-2', 'test01-commodity-1', 'test04-commodity-1', 'test08-commodity-3', 'test05-commodity-2', 'test11-phone-0', 'test13-commodity-3', 'test12-commodity-2', 'test12-commodity-4', 'test09-commodity-1', 'test01-commodity-3', 'test14-phone-0'}

